package com.twu.biblioteca;

import java.io.PrintStream;
import java.util.Collection;

/**
 * Created with IntelliJ IDEA.
 * User: thoughtworker
 * Date: 10/14/13
 * Time: 10:05 AM
 * To change this template use File | Settings | File Templates.
 */
public class MovieMenu implements MenuOptions {
    private final Collection<Movie> movieList;
    private PrintStream printStream;
    private String movieHeader = "Movie\tYear\tDirector\tRating\n";

    public MovieMenu(PrintStream printStream, Collection<Movie> movieList) {
        this.printStream = printStream;
        this.movieList = movieList;
    }

    @Override
    public void execute() {
        String movieDetails = movieHeader;

        for (Movie movie: movieList) {
            movieDetails += movie.displayMovieInfo();
        }

        printStream.println(movieDetails);
    }
}
